Getting Information for Person via Open Hluttaw API


In [59]:
import requests

person_req = requests.get('http://api.openhluttaw.org/en/persons/e5029cbf865f48e1b2e6e65e08d6c64e')
person = person_req.json()['result']

print 'Name: ' + person['name']
print 'Birthdate: ' + person['birth_date']
print 'Gender: ' + person['gender'] + "\n"

print "Contacts:\n"
for contacts in person['contact_details']:
    print contacts['label'] +": " + contacts['value']
    
print "\nPhoto URL: " + person['image']


Name: Soe Myint (or)  Aung Zaw Myint
Birthdate: 1952-10-12
Gender: male

Contacts:

Mobile: 09 2001 140
SMS: 09 2001 140
Email: agzawmyint1952@gmail.com
Phone Number: 09 7920 01140

Photo URL: http://goo.gl/8GeW53

In [64]:
#memberships

for member in person['memberships']:
    print person['name'] + " is,"
    on_behalf_req = requests.get('http://api.openhluttaw.org/en/organizations/'+ member['on_behalf_of_id'])
    on_behalf_of = on_behalf_req.json()['result']['name'] + '\n'
    
    print "Member of " + member['organization']['name'] + " as " + member['role'] + " on behalf of " + \
          on_behalf_of


Soe Myint (or)  Aung Zaw Myint is,
Member of Pyithu Hluttaw as MP on behalf of National League for Democracy

Soe Myint (or)  Aung Zaw Myint is,
Member of Pyithu Hluttaw Electric Power and Development Committee as Committee Member on behalf of National League for Democracy


In [57]:
person_req = requests.get('http://api.openhluttaw.org/my/persons/e5029cbf865f48e1b2e6e65e08d6c64e')
person = person_req.json()['result']

print person['name']
print person['birth_date']
print person['gender']

print "Contacts:\n"
for contacts in person['contact_details']:
    print contacts['value']
    
#memberships

for member in person['memberships']:
    on_behalf_req = requests.get('http://api.openhluttaw.org/my/organizations/'+ member['on_behalf_of_id'])
    on_behalf_of = on_behalf_req.json()['result']['name']
    
    print "Member of " + member['organization']['name']


စိုးမြင့်(ခ)အောင်ဇော်မြင့်
1952-10-12
ကျား
Contacts:

09 2001 140
09 2001 140
agzawmyint1952@gmail.com
09 7920 01140
Member of ပြည်သူ့လွှတ်တော်
Member of ပြည်သူ့လွှတ်တော် လှျပ်စစ်စွမ်းအင်နှင့် ဖွံ့ဖြိုးတိုးတက်ရေးကော်မတီ